package com.ITArmy.controller;

import com.ITArmy.beans.Comment;
import com.ITArmy.beans.Message;
import com.ITArmy.beans.Shows.CommentMessage;
import com.ITArmy.common.ServerResponse;
import com.ITArmy.controller.base.BaseController;
import com.ITArmy.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@Api(tags = "评论接口", value = "commentController接口层次")
@RequestMapping("/comment")
public class CommentController extends BaseController {

    @RequestMapping("/addComment")
    @ResponseBody
    @ApiOperation(value = "用户评论博客", httpMethod = "POST")
    public ServerResponse comment(HttpServletRequest request, Comment comment,Model model) {
        return commentService.comment(request, comment,model);
    }

    @RequestMapping("/deleteComment")
    @ResponseBody
    @ApiOperation(value = "用户删除评论", httpMethod = "DELETE")
    public ServerResponse deleteComment(long commentId) {
        return commentService.deleteComment(commentId);
    }


//    @RequestMapping("/informationCommentPage")
//    @ApiOperation(value = "进入消息评论页面", httpMethod = "GET")
//    public String informationCommentPage(HttpServletRequest request, Model model) {
//        List<CommentMessage> messages=messageService.getComment(request);
//        model.addAttribute("commentMessages",messages);
//        return "imformationComment";
//    }
}
